package com.atguigu.day17.list03;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/20 14:41
 * @注释
 */
public class ListTest02 {
    @Test
    public void test01(){
        List<String> list = new ArrayList<>();
        list.add("张三");
        list.add("赵四");
        list.add("王五");
        list.add("孙六");
        list.add("刘七");

        List<String> newList = new ArrayList<>();
        newList.add("李一");
        newList.add("黄二");
        list.addAll(0,newList);

        System.out.println(list);

        //删
        list.remove(0);
        System.out.println(list);

        //改
        list.set(0,"王麻子");
        System.out.println(list);

        //查
        String s = list.get(5);
        System.out.println(s);


    }
}
